package cn.cheln.explorer.beans;

import android.content.Context;
import android.util.DisplayMetrics;
import cn.cheln.support.log.Logs;
import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class ApkInfo extends FileInfo
{
  public static String DISPLAY_UNKNOWN;
  public static String DISPLAY_VERSION_CODE;
  public static String VERSION_INTALLED;
  public static String VERSION_UNINTALLED;
  public static String VERSION_UPDATETODATE;
  public static String VERSION_UPGRADE;
  public boolean isBuilt;
  public String packageName;
  public String versionCondition;
  public String versionName;
  public String versionNameStr = DISPLAY_VERSION_CODE;

  public ApkInfo()
  {
  }

  public ApkInfo(File paramFile, Context paramContext)
  {
    super(paramFile, paramContext);
  }

  public ApkInfo(String paramString)
  {
    setLeng(Long.valueOf(new File(paramString).length()));
    setSizeText(FileUtil.formatSize((float)getLeng().longValue()));
    setName(FileUtil.getName(paramString));
  }

  public static void init(Context paramContext)
  {
    VERSION_UNINTALLED = paramContext.getString(2131034234);
    VERSION_UPDATETODATE = paramContext.getString(2131034233);
    VERSION_UPGRADE = paramContext.getString(2131034235);
    VERSION_INTALLED = paramContext.getString(2131034236);
    DISPLAY_VERSION_CODE = paramContext.getString(2131034237);
    DISPLAY_UNKNOWN = paramContext.getString(2131034239);
  }

  public boolean equals(Object paramObject)
  {
    if (paramObject == null);
    do
      return false;
    while (!(paramObject instanceof FileInfo));
    return super.getPath().equals(((FileInfo)paramObject).getPath());
  }

  public boolean setApkInfo(Context paramContext)
  {
    if (getPath() == null)
      throw new IllegalStateException("should initialize path in ApkInfo");
    return setApkInfo(paramContext, new File(getPath()));
  }

  public boolean setApkInfo(Context paramContext, File paramFile)
  {
    if (this.isBuilt)
      return true;
    this.isBuilt = true;
    try
    {
      Class localClass = Class.forName("shortcut.content.pm.PackageParser");
      Constructor localConstructor = localClass.getConstructor(new Class[] { String.class });
      Object[] arrayOfObject1 = new Object[1];
      arrayOfObject1[0] = paramFile.getPath();
      Object localObject1 = localConstructor.newInstance(arrayOfObject1);
      DisplayMetrics localDisplayMetrics = new DisplayMetrics();
      localDisplayMetrics.setToDefaults();
      Class[] arrayOfClass = new Class[4];
      arrayOfClass[0] = File.class;
      arrayOfClass[1] = String.class;
      arrayOfClass[2] = DisplayMetrics.class;
      arrayOfClass[3] = Integer.TYPE;
      Method localMethod = localClass.getDeclaredMethod("parsePackage", arrayOfClass);
      Object[] arrayOfObject2 = new Object[4];
      arrayOfObject2[0] = paramFile;
      arrayOfObject2[1] = paramFile.getPath();
      arrayOfObject2[2] = localDisplayMetrics;
      arrayOfObject2[3] = Integer.valueOf(0);
      Object localObject2 = localMethod.invoke(localObject1, arrayOfObject2);
      this.packageName = localObject2.getClass().getField("packageName").get(localObject2).toString();
      this.versionName = localObject2.getClass().getField("mVersionName").get(localObject2).toString();
      this.versionNameStr = DISPLAY_VERSION_CODE + " " + this.versionName;
      return true;
    }
    catch (Exception localException)
    {
      this.versionNameStr = DISPLAY_VERSION_CODE + " " + DISPLAY_UNKNOWN;
    }
    return false;
  }

  public static class ApkVersionName
    implements Comparable<ApkVersionName>
  {
    public String versionName;

    public ApkVersionName(String paramString)
    {
      if (paramString != null);
      for (String str = paramString.trim(); ; str = null)
      {
        this.versionName = str;
        return;
      }
    }

    public int compareTo(ApkVersionName paramApkVersionName)
    {
      label50: int j;
      int l;
      if (this.versionName.trim().equals(paramApkVersionName.versionName))
        return 0;
      String str1 = "";
      String str2 = "";
      String str3 = "";
      if (this.versionName.length() - paramApkVersionName.versionName.length() > 0);
      int i = 0;
      if (i >= this.versionName.length())
      {
        j = 0;
        label65: if (j < paramApkVersionName.versionName.length())
          break label232;
        int k = str2.length() - str3.length();
        l = 0;
        label92: if (l < Math.abs(k))
          break label296;
        if (k <= 0)
          break label322;
        str3 = str3 + str1;
      }
      while (true)
      {
        Logs.i("", "v=== " + str3 + " " + str2);
        return (Integer.parseInt(str2) - Integer.parseInt(str3));
        char c1 = this.versionName.charAt(i);
        if (Character.isDigit(c1))
          str2 = str2 + new String(new Character(c1).toString());
        ++i;
        break label50:
        label232: char c2 = paramApkVersionName.versionName.charAt(j);
        if (Character.isDigit(c2))
          str3 = str3 + new String(new Character(c2).toString());
        ++j;
        break label65:
        label296: str1 = str1 + "0";
        ++l;
        break label92:
        label322: str2 = str2 + str1;
      }
    }
  }
}

/* Location:           H:\360云盘\lewa_explorer_3.0\bin\FileApp_orig_dex2jar.jar
 * Qualified Name:     cn.cheln.explorer.beans.ApkInfo
 * JD-Core Version:    0.5.2
 */